package org.hydrakyoufeng.stuplatform.config;


import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QiniuConfig {

    /**
     * 七牛云参数
     */
    @Data
    public class QiniuProperties{
        private String accessKey;

        private String secretKey;

        private String bucket;

        private String remoteAddr;
    }

    /**
     * 获取一个公开空间七牛云参数对象
     * ConfigurationProperties注解：读取配置文件中的前缀为qiniu的参数
     * @return
     */
    @Bean
    @ConfigurationProperties(prefix = "qiniu")
    public QiniuProperties qiniuProperties(){
        return new QiniuProperties();
    }

    /**
     * 获取一个私有空间七牛云参数对象
     * ConfigurationProperties注解：读取配置文件中的前缀为qiniu的参数
     * @return
     */
    @Bean
    @ConfigurationProperties(prefix = "qiniu-secret")
    public QiniuProperties qiniuSecretProperties(){
        return new QiniuProperties();
    }

}
